package com.appspot.gwtsimple.server;

import com.appspot.gwtsimple.client.ClickHandlerService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Random;

/**
 * User: Igor
 * Date: 23.05.2011
 * Time: 21:10:12
 */
public class ClickHandlerServiceImpl extends RemoteServiceServlet implements ClickHandlerService
{
	public static final String GAE = "GAE";
	public static final String GWT = "GWT";

	private static Random random = new Random();

	@Override
	public String click(int x, int y)
	{
		HttpServletRequest req = getThreadLocalRequest();
		System.out.println("sessioinId="+req.getSession(true).getId());
		return (random.nextBoolean() ? GWT : GAE);
	}
}
